package solution;

import java.util.HashSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-01-19
 * Time: 17:08
 */

//https://leetcode.cn/problems/contains-duplicate/solutions/
class Solution4 {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> hs = new HashSet<>();
        for (int i : nums) {
            if (!hs.add(i)) {
                return true;
            }
        }
        return false;
    }
}
